package com.df.happylearn.glide;

import android.content.Context;
import android.os.Environment;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.cache.DiskCache;
import com.bumptech.glide.load.engine.cache.DiskLruCacheWrapper;
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
import com.bumptech.glide.load.engine.cache.LruResourceCache;
import com.bumptech.glide.module.GlideModule;

import java.io.File;

/**
 * Created by dingfeng on 2016/7/29.
 */
public class GlideConfiguration implements GlideModule {

    private static final int cacheSize = 50 * 1024 * 1024; // 50M

    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        // decode fromat
        builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
        // set cache size
        builder.setDiskCache(new InternalCacheDiskCacheFactory(context, cacheSize));
    }

    @Override
    public void registerComponents(Context context, Glide glide) {

    }
}
